package com.deguru.main.utils;

import java.io.InputStream;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

public class SqlSessTools {

	private String file = "doc/mybatis-config.xml";

	SqlSession sqlSession = null;
	
	public SqlSession getSs() {
		InputStream inputStream = SqlSessTools.class.getClassLoader().getResourceAsStream(file);
		SqlSessionFactory factory = new SqlSessionFactoryBuilder().build(inputStream);
		sqlSession = factory.openSession();
		return sqlSession;
	}

	public void ssClose() {
		sqlSession.close();
	}

}
